import { Controller, Post, Body, UseGuards, Get, Query } from '@nestjs/common';
import { TagManageService } from './tag-manage.service';
import { CreateTagManageDto } from './dto/create-tag-manage.dto';
import { AuthGuard } from 'src/gurad/auth/auth.guard';

@UseGuards(AuthGuard)
@Controller('tag-manage')
export class TagManageController {
  constructor(private readonly tagManageService: TagManageService) {}

  /**
   * 新增标签
  */
  @Post('add')
  create(@Body() createTagManageDto: CreateTagManageDto) {
    return this.tagManageService.create(createTagManageDto);
  }
  /**
   * 获取分类列表
   */
  @Get('query')
  query(@Query() queryInfo){
    return this.tagManageService.query({
      ...queryInfo,
      currentPage: +queryInfo.currentPage,
      pageSize: +queryInfo.pageSize,
    });
  }
  /**
 * 删除标签
 */
  @Post('delete')
  delete(@Body() queryInfo) {
    return this.tagManageService.delete(queryInfo.id);
  }
   /**
   * 获取所有的标签
  */
   @Get('queryAll')
   getAll() {
     return this.tagManageService.getAll()
   }
}
